from django.views import View
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from django.utils.decorators import method_decorator
from .models import User


@method_decorator(csrf_exempt, name='dispatch')
class UserView(View):
    # 列出所有 User（GET）
    def get(self, request, *args, **kwargs):
        # pass
        return JsonResponse([{"name": "michael"}], safe=False, status=200)

    # 创建 User（POST）
    def post(self, request, *args, **kwargs):
        pass

    # 修改 User（PUT）
    def put(self, request, pk, *args, **kwargs):
        pass

    # 删除 User（DELETE）
    def delete(self, request, pk, *args, **kwargs):
        pass


